package ga.individuals;

public class Fitness {
	public static Double maximize (Individual individual) {
		return getFitnessValue(individual.getIndividualValue());
	}
	
	public static Double minimize (Individual individual) {
		return 1.0/getFitnessValue(individual.getIndividualValue());
	}
	
	private static Double getFitnessValue (Double individualValue) {
		return 10.0 * (individualValue/5.0 - Math.pow(individualValue, 3.0) - Math.pow(individualValue, 5.0)) * Math.exp(-2*Math.pow(individualValue, 2.0)) + 5;
	}
}
